package br.com.virtual.base.uteis;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class EJBLookup {

	
	public static Object lookup(String serviceLookup){
		
        try {
        	
        	Properties jndiProps = new Properties();
            jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,         
            "org.jboss.naming.remote.client.InitialContextFactory");
            jndiProps.put(Context.PROVIDER_URL,"remote://localhost:4447");
            jndiProps.put(Context.SECURITY_PRINCIPAL, "vs");
            jndiProps.put(Context.SECURITY_CREDENTIALS, "hrpbsmm");
            jndiProps.put("jboss.naming.client.ejb.context", true);
            Context	ctx = new InitialContext(jndiProps);
            return ctx.lookup(serviceLookup);
		} catch (NamingException e) {
			e.printStackTrace();
			return null;
		}
	}
	
	
	
	
}
